﻿using UnityEngine;
using System.Collections;

public class Gun : MonoBehaviour {

    public GameObject BulletFab;
    public float RoF = 2.5f;

    Transform Trnsfrm;
    float Next;
    void Awake() {
        Next = Random.Range(0,RoF);
        Trnsfrm = transform;
    }

    void Update () {
        if(Time.time > Next) {
            Next += RoF;

            ((GameObject)Instantiate( BulletFab, Trnsfrm.position, Trnsfrm.rotation)).GetComponent<Bullet>().Src = collider;
        }
	}
}
